Skip to content

feat(Select): mark the latest version with a badge instead of a label suffix - #1157

Merged
sukvvon merged 2 commits into
mainfrom
feat/version-select-latest-badge
Aug 14, 2026
Merged

feat(Select): mark the latest version with a badge instead of a label suffix#1157
sukvvon merged 2 commits into
mainfrom
feat/version-select-latest-badge

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 14, 2026

Copy link
Copy Markdown
Member

The version picker rendered the current version as one string, v5 - Latest, so the version number and the "this is current" marker competed for the same reading. Pulling the marker into a badge lets the number carry the label on its own.

SelectOption gains an optional badge, matching the existing optional logo:

{ label: version, value: 'latest', badge: 'Latest' }

label stays a string, so the two places Select consumes it as text (alt={${option.label} logo}) are unaffected.

The badge is the DS Badge with no props and no style overrides, so it renders the neutral default variant (bg-background-subtle / text-text-secondary). That keeps it clear of every library's accent colour — the docs sidebar sits inside a library-themed page, and a coloured badge would compete there. UI-chrome badges across admin/ and account/ use the component's defaults the same way; the squared, mono, uppercase treatment belongs to the landing pages, which are a separate visual language.

Scope

SelectOption is constructed in exactly one place (VersionSelect). FrameworkSelect passes no badge, so its render path is unchanged — verified by measurement, not just by reading: its trigger still measures 207px with no badge node. ShopSelect is an unrelated component in shop/ui/. Nothing in src/, tests/, or scripts/ depends on the " - Latest" string.

Verified in the browser

VersionSelect renders in two places in LibraryLayout — the desktop sidebar and the mobile drawer — and both were checked:

trigger width overflow
desktop sidebar (1152px) 207px none
mobile drawer (500px) 468px none

In the open dropdown the badge's right edge sits 66px clear of the check mark, so the row's pr-8 reservation still holds. Checked on Query (v5/v4/v3) and Router (v1, single option).

Accessibility is unchanged. The badge is display: flex, so the accessible name computation inserts a boundary: innerText reads "v5\nLatest" where it previously read "v5 - Latest". Both announce as two words. Separately, the select trigger has no accessible name at all — but FrameworkSelect, which this PR does not touch, has the same gap, so it predates this change and is left for its own fix.

tsc, oxlint and the 140 unit tests pass.

Screenshot

AS-IS

image

TO-BE

image image

Summary by CodeRabbit

  • New Features

    • Select options can now display an optional badge alongside their labels in the selected value and dropdown list.
  • UI Improvements

    • The latest-version option now shows only the version number with a separate “Latest” badge for clearer presentation.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 184f1904-9ee4-473c-bb36-1fd6f840699a

📥 Commits

Reviewing files that changed from the base of the PR and between bc58e74 and 948e479.

📒 Files selected for processing (1)
  • src/components/Select.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Select.tsx

📝 Walkthrough

Walkthrough

The select component now supports optional badges for selected and dropdown options. VersionSelect displays the latest version number with a separate Latest badge.

Changes

Select option badges

Layer / File(s) Summary
Select badge contract and rendering
src/components/Select.tsx
SelectOption now accepts an optional badge value. Select renders the value with Badge beside selected and dropdown option labels.
Latest version badge wiring
src/components/VersionSelect.tsx
The latest version option uses the version number as its label and displays Latest as a separate badge.

Estimated code review effort: 2 (Simple) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 948e4

The latest-version marker is moved into a badge without changing the version value or other select behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes replacing the latest-version label suffix with a badge in Select.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-select-latest-badge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sukvvon sukvvon self-assigned this Aug 14, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 948e479 Commit Preview URL

Branch Preview URL
Aug 14 2026, 05:33 PM

@sukvvon
sukvvon merged commit c3da893 into main Aug 14, 2026
7 checks passed
@sukvvon
sukvvon deleted the feat/version-select-latest-badge branch August 14, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants